package com.cn.customer.housekeeping.housekeepingb.util;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.provider.Settings;

import com.cn.customer.housekeeping.housekeepingb.TabMainActivity;
import com.cn.customer.housekeeping.housekeepingb.bean.ImageInfo;
import com.cn.customer.housekeeping.housekeepingb.bean.PayParameterResp;
import com.cn.customer.housekeeping.housekeepingb.citypicker.CityPickerActivity;
import com.cn.customer.housekeeping.housekeepingb.constant.Constants;
import com.cn.customer.housekeeping.housekeepingb.ui.AlbumSwipeActivity;
import com.cn.customer.housekeeping.housekeepingb.ui.ChoiceBusinessTimeActivity;
import com.cn.customer.housekeeping.housekeepingb.ui.ChoicePositionActivity;
import com.cn.customer.housekeeping.housekeepingb.ui.ChoiceShopActivity;
import com.cn.customer.housekeeping.housekeepingb.ui.ClassifyActivity;
import com.cn.customer.housekeeping.housekeepingb.ui.IdeaSwipeActivity;
import com.cn.customer.housekeeping.housekeepingb.ui.LoginPasswordActivity;
import com.cn.customer.housekeeping.housekeepingb.ui.MapChoiceActivity;
import com.cn.customer.housekeeping.housekeepingb.ui.MerchandiseDetailsActivity;
import com.cn.customer.housekeeping.housekeepingb.ui.MerchandisePlaceOrderActivity;
import com.cn.customer.housekeeping.housekeepingb.ui.MerchandiseTrackActivity;
import com.cn.customer.housekeeping.housekeepingb.ui.OrderDetailsActivity;
import com.cn.customer.housekeeping.housekeepingb.ui.OrderFragmentListActivity;
import com.cn.customer.housekeeping.housekeepingb.ui.PayActivity;
import com.cn.customer.housekeeping.housekeepingb.ui.PlaceDetailsActivity;
import com.cn.customer.housekeeping.housekeepingb.ui.RegisterActivity;
import com.cn.customer.housekeeping.housekeepingb.ui.ShopOrderListActivity;
import com.cn.customer.housekeeping.housekeepingb.ui.WebviewActivity;

import java.util.ArrayList;


public class NavUtils {

    /**
     * 启动应用的设置
     *
     * @since 2.5.0
     */
    public static void startAppSettings(Activity context) {
        Intent intent = new Intent(
                Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        intent.setData(Uri.parse("package:" + context.getPackageName()));
        context.startActivity(intent);
    }
    /**
     * 打开H5
     */
    public static void gotoWebviewActivity(Activity context, String url, String title) {
        Intent intent = new Intent(context, WebviewActivity.class);
        intent.putExtra(Constants.WEBVIEW_URL, url);
        intent.putExtra(Constants.WEBVIEW_TITLE, title);
        context.startActivity(intent);

    }
    /**
     *
     */
    public static void gotoRegisterActivity(Activity context) {
        Intent intent = new Intent(context, RegisterActivity.class);
        context.startActivity(intent);
    }
    /**
     *
     */
    public static void gotoLoginPasswordActivity(Activity context) {
        Intent intent = new Intent(context, LoginPasswordActivity.class);
        context.startActivity(intent);
    }
    /**
     *
     */
    public static void gotoTabMainActivity(Activity context) {
        Intent intent = new Intent(context, TabMainActivity.class);
        context.startActivity(intent);
    }
    public static void gotoClassifyActivity(Activity context) {
        Intent intent = new Intent(context, ClassifyActivity.class);
        context.startActivity(intent);
    }
    public static void gotoCityPickerActivity(Activity context,int requestCode) {
        Intent intent = new Intent(context, CityPickerActivity.class);
        context.  startActivityForResult(intent,
                requestCode);
    }

    public static void gotoMerchandiseDetailsActivity(Context context) {
        Intent intent = new Intent(context, MerchandiseDetailsActivity.class);
        context.startActivity(intent);
    }

    public static void gotoMerchandiseTrackActivity(Context context) {
        Intent intent = new Intent(context, MerchandiseTrackActivity.class);
        context.startActivity(intent);
    }



    public static void gotoMerchandisePlaceOrderActivity(Context context,String serviceid) {
        Intent intent = new Intent(context, MerchandisePlaceOrderActivity.class);
        intent.putExtra(Constants.serviceid, serviceid);
        context.startActivity(intent);
    }


    public static void gotoOrderFragmentListActivity(Context context,String type,String cityname,String title) {
        Intent intent = new Intent(context, OrderFragmentListActivity.class);
        intent.putExtra(Constants.type, type);
        intent.putExtra(Constants.cityname, cityname);
        intent.putExtra(Constants.title, title);
        context.startActivity(intent);
    }

    public static void gotoOrderDetailsActivity(Context context,String serviceid) {
        Intent intent = new Intent(context, OrderDetailsActivity.class);
        intent.putExtra(Constants.serviceid, serviceid);
        context.startActivity(intent);
    }

    public static void gotoMapChoiceActivity(Activity context,int result) {
        Intent intent = new Intent(context, MapChoiceActivity.class);
        context.startActivityForResult(intent, result);
    }

    public static void gotoPayActivity(Context context, PayParameterResp mPayParameterResp) {
        Intent intent = new Intent(context, PayActivity.class);
        intent.putExtra(Constants.PayParameterResp, mPayParameterResp);
        context.startActivity(intent);
    }
    public static void gotoShopOrderListActivity(Context context,String shopid) {
        Intent intent = new Intent(context, ShopOrderListActivity.class);
        intent.putExtra(shopid, shopid);

        context.startActivity(intent);
    }
    public static void gotoIdeaSwipeActivity(Context context) {
        Intent intent = new Intent(context, IdeaSwipeActivity.class);
        context.startActivity(intent);
    }
    /**
     * @param context
     */
    public static void gotoAlbumSwipeActivity(Activity context, ArrayList<ImageInfo> mSelectImgList, boolean isMultiselect, int ResultID) {
        Intent intent = new Intent(context, AlbumSwipeActivity.class);
        intent.putExtra(Constants.IMG_URLS, mSelectImgList);
        intent.putExtra(Constants.ISMULTISELECT, isMultiselect);
        context.startActivityForResult(intent, ResultID);
//        context.overridePendingTransition(R.anim.slide_right_in,
//                R.anim.slide_left_out);
    }




    /**
     *
     */
    public static void gotoChoiceShopActivity(Activity context, int ResultID) {
        Intent intent = new Intent(context, ChoiceShopActivity.class);
        context.startActivityForResult(intent, ResultID);
    }

    /**
     *
     */
    public static void gotoChoiceBusinessTimeActivity(Activity context, int ResultID) {
        Intent intent = new Intent(context, ChoiceBusinessTimeActivity.class);
        context.startActivityForResult(intent, ResultID);
    }
    /**
     * @param context
     */
    public static void gotoChoicePositionActivity(Activity context, int ResultID) {
        Intent intent = new Intent(context, ChoicePositionActivity.class);
        context.startActivityForResult(intent, ResultID);

    }

    /**
     * @param context
     */
    public static void gotoPlaceDetailsActivity(Activity context, int ResultID,String Pname,String Paddress,String PLat,String Plong) {
        Intent intent = new Intent(context, PlaceDetailsActivity.class);
        intent.putExtra(Constants. Pname,  Pname);
        intent.putExtra(Constants. Paddress,  Paddress);
        intent.putExtra(Constants. PLat,  PLat);
        intent.putExtra(Constants. PLong,  Plong);



        context.startActivityForResult(intent, ResultID);

    }

}
